From: Keir Fraser Date: Sun, 17 Jan 2010 18:01:08 +0000 (+0000) Subject: xend: NUMA: fix division by zero on unpopulated nodes X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12730 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=c9aa64e0624be510f896ad90ec050bbbbeff4e7a;p=xen.git xend: NUMA: fix division by zero on unpopulated nodes nodes without memory will currently be disabled by also moving the physical cores connected to them to other nodes. This leads to nodes without CPUs and thus to a division by zero in the node allocation algorithm. Attached patch fixes this by checking for 0 before the division. This fixes domain creation on boxes with memory-less nodes. Signed-off-by: Andre Przywara --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 6c23fc9be7..21fb719891 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -2709,9 +2709,12 @@ class XendDomainInfo: nodeload[i] += 1 break for i in range(0, nr_nodes): - nodeload[i] = int(nodeload[i] * 16 / len(info['node_to_cpu'][i])) - if len(info['node_to_cpu'][i]) == 0 or i not in node_list: + if len(info['node_to_cpu'][i]) == 0: nodeload[i] += 8 + else: + nodeload[i] = int(nodeload[i] * 16 / len(info['node_to_cpu'][i])) + if i not in node_list: + nodeload[i] += 8 return map(lambda x: x[0], sorted(enumerate(nodeload), key=lambda x:x[1])) info = xc.physinfo()